home *** CD-ROM | disk | FTP | other *** search
- property maxSlots, slotAddedP
- global dispatchTable, scoreData
-
- on birth me
- init(me)
- set slotAddedP to 0
- return me
- end
-
- on init me
- set maxSlots to 12
- clear(me)
- end
-
- on clear me
- set dispatchTable to []
- end
-
- on isEmptyP me
- if dispatchTable = 0 then
- return 1
- else
- return 0
- end if
- end
-
- on isFullP me
- if count(dispatchTable) >= maxSlots then
- return 1
- else
- return 0
- end if
- end
-
- on findDuplicateCategory me, theGroup
- set found to 0
- set slotNum to 1
- repeat with curSlot in dispatchTable
- if theGroup = getAt(curSlot, 2) then
- set curDataChannel to getAt(curSlot, 3)
- set found to 1
- exit repeat
- end if
- set slotNum to slotNum + 1
- end repeat
- if found then
- set slotAddedP to 0
- return curDataChannel
- else
- return found
- end if
- end
-
- on addNewSlot me, theType, theCategory, clipDataField
- set curClipType to theType
- set curClipGroup to theCategory
- set junkList to []
- repeat with curSlot in dispatchTable
- add(junkList, getAt(curSlot, 3))
- end repeat
- sort(junkList)
- set curDataChannel to 1
- repeat with slot in junkList
- if slot <> curDataChannel then
- exit repeat
- end if
- set curDataChannel to curDataChannel + 1
- end repeat
- append(dispatchTable, [curClipType, curClipGroup, curDataChannel, clipDataField])
- set slotAddedP to 1
- return curDataChannel
- end
-
- on insertProp me, theType, theCategory
- set tempDispatchTable to []
- set thePropSlot to getLast(dispatchTable)
- deleteAt(dispatchTable, count(dispatchTable))
- repeat with count = 1 to count(dispatchTable)
- set theSearchType to getAt(getAt(dispatchTable, count), 1)
- if (theSearchType <> "S") and (theSearchType <> "P") then
- exit repeat
- end if
- end repeat
- if count > 1 then
- repeat with theSlotNumber = 1 to count - 1
- append(tempDispatchTable, getAt(dispatchTable, theSlotNumber))
- end repeat
- append(tempDispatchTable, thePropSlot)
- repeat with theSlotNumber = count to count(dispatchTable)
- append(tempDispatchTable, getAt(dispatchTable, theSlotNumber))
- end repeat
- else
- append(tempDispatchTable, thePropSlot)
- repeat with theSlot in dispatchTable
- append(tempDispatchTable, theSlot)
- end repeat
- end if
- set dispatchTable to tempDispatchTable
- set slotAddedP to 1
- end
-
- on getLayer me, theGroup
- set found to 0
- set slotNum to 1
- repeat with curSlot in dispatchTable
- if theGroup = getAt(curSlot, 2) then
- set curDataChannel to getAt(curSlot, 3)
- set found to 1
- exit repeat
- end if
- set slotNum to slotNum + 1
- end repeat
- if found then
- return slotNum
- else
- return found
- end if
- end
-
- on updateStackPanel me
- update(stackMgr)
- end
-
- on deleteLastSlot me, theGroup
- if slotAddedP then
- set found to 0
- set slotNum to 1
- repeat with curSlot in dispatchTable
- if theGroup = getAt(curSlot, 2) then
- set curDataChannel to getAt(curSlot, 3)
- set found to 1
- exit repeat
- end if
- set slotNum to slotNum + 1
- end repeat
- if found then
- deleteAt(dispatchTable, slotNum)
- end if
- end if
- end
-
- on updateDispatchTable me
- set dispatchMap to []
- repeat with theSlot in dispatchTable
- set channelNumber to getAt(theSlot, 3)
- set found to 0
- repeat with theFrame in scoreData
- if getAt(theFrame, channelNumber) <> EMPTY then
- set found to 1
- exit repeat
- end if
- end repeat
- if found = 1 then
- add(dispatchMap, 1)
- next repeat
- end if
- add(dispatchMap, 0)
- end repeat
- set numberOfSlots to count(dispatchTable)
- repeat with theSlot = 1 to numberOfSlots
- if getAt(dispatchMap, theSlot) = 0 then
- deleteAt(dispatchTable, theSlot)
- end if
- end repeat
- updateStackPanel(me)
- end
-